package com.example.database.common.message;

import java.util.Date;

public class ResponseMessage<T>  {
    private Date serviceTime =new Date();
    private T Data;
    private String Message;
    private EMessageCode messageCode=EMessageCode.Ok;

    public ResponseMessage(Date serviceTime, T data, String message, EMessageCode messageCode) {
        this.serviceTime = serviceTime;
        Data = data;
        Message = message;
        this.messageCode = messageCode;
    }

    public Date getServiceTime() {
        return serviceTime;
    }

    public void setServiceTime(Date serviceTime) {
        this.serviceTime = serviceTime;
    }

    public T getData() {
        return Data;
    }

    public void setData(T data) {
        Data = data;
    }

    public String getMessage() {
        return Message;
    }

    public void setMessage(String message) {
        Message = message;
    }

    public EMessageCode getMessageCode() {
        return messageCode;
    }

    public void setMessageCode(EMessageCode messageCode) {
        this.messageCode = messageCode;
    }
    public static <T> ResponseMessage<T> GetMessage(T data){
        return new ResponseMessage<>(new Date(),data,"ok",EMessageCode.Ok);
    }
}
